import React from "react";
import { useRoutes } from "react-router-dom";
import PushMusic from "../pages/ContentCenter/PushMusic";
import HotMusic from "../pages/ContentCenter/HotMusic";
import Search from "../pages/ContentCenter/Search";
import Index from "../pages/ContentCenter/Main";
import PlayList from "../pages/ContentCenter/PlayList";
import Player from "../pages/ContentCenter/Player";
import HomePage from "../pages/ContentCenter/HomePage";
import Login from "../pages/ContentCenter/Login-Register/Login";
import Register from "../pages/ContentCenter/Login-Register/Register";
import UserPage from "../pages/ContentCenter/UserPage";
import NotFound from "../pages/ContentCenter/404";

export function TotalRouter() {
  const element = useRoutes([
    {
      path: "/",
      element: <Index />,
      children: [
        {
          path: "/",
          element: <PushMusic />,
        },
        {
          path: "PushMusic",
          element: <PushMusic />,
        },
        {
          path: "HotMusic",
          element: <HotMusic />,
        },
        {
          path: "Search",
          element: <Search />,
        },
      ],
    },
    {
      path: "*",
      element: <NotFound/>,
    },
    {
      path: "/PlayList/detail",
      element: <PlayList />,
    },
    {
      path: "/song",
      element: <Player />,
    },
    {
      path: "/homepage",
      element: <HomePage />,
    },
    {
      path: "/login",
      element: <Login />,
    },
    {
      path: "/register",
      element: <Register />,
    },
    {
      path: "/userpage",
      element: <UserPage />,
    },
  ]);
  return element;
}

// const GetUserRoutes = () => {
//   const routes = useRoutes([
//     {
//       path: "/",
//       element: <Index />,
//       children: [
//         {
//           path: "/",
//           element: <PushMusic />,
//         },
//         {
//           path: "PushMusic",
//           element: <PushMusic />,
//         },
//         {
//           path: "HotMusic",
//           element: <HotMusic />,
//         },
//         {
//           path: "Search",
//           element: <Search />,
//         },
//       ],
//     },
//     {
//       path: "*",
//       element: "there is nothing here",
//     },
//     {
//       path: "/PlayList/detail",
//       element: <PlayList />,
//       //  children: [
//       //   {
//       //     path:':id',
//       //     element: <ProfilePage />,
//       //   }]
//     },
//     {
//       path: "/song",
//       element: <Player />,
//     },
//     {
//       path: "/homepage",
//       element: <HomePage />,
//     },
//     // {
//     //   path:'/login',
//     //   element: <Login />,
//     // },
//     {
//       path: "/register",
//       element: <Register />,
//     },
//   ]);
//   return routes;
// };

// const GetVisitorRoutes = () => {
//   const routes = useRoutes([
//     {
//       path: "/temp",
//       element: <Index />,
//       children: [
//         {
//           path: "/temp",
//           element: <PushMusic />,
//         },
//         {
//           path: "PushMusic",
//           element: <Login />,
//         },
//         {
//           path: "HotMusic",
//           element: <Login />,
//         },
//         {
//           path: "Search",
//           element: <Login />,
//         },
//       ],
//     },
//     {
//       path: "*",
//       element: <Login />,
//     },
//   ]);
//   return routes;
// };

// const GetAllRoutes=()=>{
//   const routes = useRoutes([
//     {
//       path: "/*",
//       element: <GetUserRoutes />,
//     },
//     {
//       path: "/temp/*",
//       element: <GetVisitorRoutes />,
//     },
//     {
//       path: "*",
//       element: <div>404</div>,
//     },
//   ])
//   return routes
// }

// export function SetRoutes(){
//   return (
//       <GetAllRoutes />
//   )
// }
